/*
 * allocations.c
 *
 * Created: 6/13/2013 3:55:44 PM
 *  Author: Tim
 */ 

#include "allocations.h"

volatile uint8_t	outputSuperPacketLength		=	4;
volatile uint8_t	inputSuperPacketLength		=	4;
volatile uint8_t	actuatorSuperPacketLength	=	4;

daqCal_t daqCal;

daqAlloc_t daqAlloc =
{
	.actuatorAlloc	= 0,
	.analogAlloc	= 0,
	.digitalIn		= 0,
	.digitalOut		= 0,
	.dio			= 0,
	.encAlloc		= 0,
	.timerAlloc		= 0
};

void allocTimer(tmrAlloc_t tmr)
{
	switch(tmr)
	{
	case TIMER_C0:
		daqAlloc.timerAlloc.timerC0Alloc = FEATURE_UTILIZED;
	break;
	case TIMER_C1:
		daqAlloc.timerAlloc.timerC1Alloc = FEATURE_UTILIZED;
	break;
	case TIMER_D0:
		daqAlloc.timerAlloc.timerD0Alloc = FEATURE_UTILIZED;
	break;
	case TIMER_D1:
		daqAlloc.timerAlloc.timerD1Alloc = FEATURE_UTILIZED;
	break;
	case TIMER_E0:
		daqAlloc.timerAlloc.timerE0Alloc = FEATURE_UTILIZED;
	break;
		
	}
	
}

void unAllocTimer(tmrAlloc_t tmr)
{
	switch(tmr)
	{
		case TIMER_C0:
		daqAlloc.timerAlloc.timerC0Alloc = FEATURE_FREE;
		break;
		case TIMER_C1:
		daqAlloc.timerAlloc.timerC1Alloc = FEATURE_FREE;
		break;
		case TIMER_D0:
		daqAlloc.timerAlloc.timerD0Alloc = FEATURE_FREE;
		break;
		case TIMER_D1:
		daqAlloc.timerAlloc.timerD1Alloc = FEATURE_FREE;
		break;
		case TIMER_E0:
		daqAlloc.timerAlloc.timerE0Alloc = FEATURE_FREE;
		break;
		
	}
	
}